/*
    created: 2023/3/31
    filename:  Abstract_Factory.cpp
    author: 李东霖
    purpose: AbstractFactory的演示代码
            实现Abstract_Factory.h
*/
#include<iostream>
#include"Abstract_Factory.h"

using namespace std;

//实现派生类ProductA1
ConcreteProductA1::ConcreteProductA1()
{
    std::cout << "construction of ConcreateProductA1\n";
}
ConcreteProductA1::~ConcreteProductA1()
{
    std::cout << "destruction of ConcreateProductA1\n";
}

//实现派生类ProductA2
ConcreteProductA2::ConcreteProductA2()
{
    std::cout << "construction of ConcreateProductA2\n";
}
ConcreteProductA2::~ConcreteProductA2()
{
    std::cout << "destruction of ConcreateProductA2\n";
}

//实现派生类ProductB1
ConcreteProductB1::ConcreteProductB1()
{
    std::cout << "construction of ConcreateProductB1\n";
}
ConcreteProductB1::~ConcreteProductB1()
{
    std::cout << "destruction of ConcreateProductB1\n";
}

//实现派生类ProductB2
ConcreteProductB2::ConcreteProductB2()
{
    std::cout << "construction of ConcreateProductB2\n";
}
ConcreteProductB2::~ConcreteProductB2()
{
    std::cout << "destruction of ConcreateProductA2\n";
}

//实现工厂派生类ConcreateFactory1
ConcreateFactory1::ConcreateFactory1()
{
    std::cout << "construction of ConcreateFactory1\n";
}
ConcreateFactory1::~ConcreateFactory1()
{
    std::cout << "destruction of ConcreateFactory1\n";
}
//实现生产ProductA1、ProductB1的纯虚函数
AbstractProductA* ConcreateFactory1::CreateProductA()
{   
    return new ConcreteProductA1();
}

AbstractProductB* ConcreateFactory1::CreateProductB()
{   
    return new ConcreteProductB1();
}





//实现工厂派生类ConcreateFactory2
ConcreateFactory2::ConcreateFactory2()
{
    std::cout << "construction of ConcreateFactory2\n";
}
ConcreateFactory2::~ConcreateFactory2()
{
    std::cout << "destruction of ConcreateFactory2\n";
}
//实现生产ProductA2、ProductB2的纯虚函数
AbstractProductA* 2::CreateProductA()
{   
    return new ConcreteProductA2();
}

AbstractProductB* ConcreateFactory2::CreateProductB()
{   
    return new ConcreteProductB2();
}

